package org.dl.gjz.menyj.task.service.deletegate;

import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.springframework.stereotype.Service;

/**
 * @ClassName EY-PoolHandleOrder
 * @Description org.dl.gjz.menyj.task.service.deletegate
 * @Author menyj
 * @Date 2025/9/2
 **/
@Service("poolHandleOrder")
public class PoolHandleOrder implements JavaDelegate {
    @Override
    public void execute(DelegateExecution execution) throws Exception {
        System.out.println("处理餐厅订单开始");
        String endpoint  = (String)execution.getVariable("endpoint");
        RuntimeService runtimeService = execution.getProcessEngine().getRuntimeService();
        if ("alipay".equals(endpoint)) {
            runtimeService.startProcessInstanceByMessage("Message_alipay1");
        }
        else if("wechat".equals(endpoint)) {
            runtimeService.startProcessInstanceByMessage("Message_wechat1");
        }
        else {
            System.out.println("endpoint 不在枚举范围内，处理订单失败");
        }
    }
}
